<!DOCTYPE html>
<html>
<head>
    {include file='public/meta'/}
    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/css/tidy.css"/>
    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/css/index.css"/>


    <script src="__STATIC_URL__/static/laydate/laydate.js"></script>
    <script src="__STATIC_URL__/static/js/times.js"></script>


</head>
<body>
{include file='public/header'/}
<section>
    <!------------------导航-------------------------->
    {include file='public/left'/}
    <!--------------------------主要内容区域------------------------------------->
    <div class="content">
        <div class="page-heading mgl15 mgr15">
            <ul class="breadcrumb">
                <li>当前位置是&nbsp;:</li>
                <li><a href="{:url('cardus/cardinfo',['card_id'=>$card['card_id']])}">会员卡</a></li>
                <li>&nbsp<a href="{:url('shop/shopmall',['card_id'=>$card['card_id']])}"> 积分商城</a></li>
                <li class="active" style="color: #02b87f;">商品列表</li>
            </ul>
        </div>
        <div class="panel panel-default mgr15 mgl15">
            <div class="panel-heading">
                <h3 class="panel-title">
                    筛选分类

                </h3>
            </div>
            <div class="panel-body">
                <form action="" method="get" class="form-horizontal table-search form-search" role="form" id="machform">
                    <div class="col-xs-12 col-sm-6 col-md-6 col-lg-4 ">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">商品名称：</label>
                            <div class="col-sm-9">
                                <input type="text" autocomplete="off" disableautocomplete="" class="form-control" placeholder="请输入商品名称" value="{$p_data['goods_name']}" name="goods_name">
                            </div>
                        </div>
                    </div>
                    <div class="col-xs-12 col-sm-6 col-md-6 col-lg-4 ">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">商品类型：</label>
                            <div class="col-sm-9">
                                <select name="goods_type" class="form-control">
                                    <option value="">--请选择状态--</option>
                                    <option value="card_dis" {if condition="$p_data['goods_type'] eq 'card_dis'" }selected{/if}>卡券</option>
                                    <option value="red_money" {if condition="$p_data['goods_type'] eq 'red_money'" }selected{/if}>现金红包</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="col-xs-12 col-sm-6 col-md-6 col-lg-4 ">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">商品状态：</label>
                            <div class="col-sm-9">
                                <select name="statu" id="statu" class="form-control">
                                    <option value="">--请选择状态--</option>
                                    <option value="0" {if condition="$p_data['statu'] eq '0'" }selected{/if}>正常</option>
                                    <option value="1" {if condition="$p_data['statu'] eq '1'" }selected{/if}>下架</option>
                                </select>
                            </div>
                        </div>
                    </div>
                    <div class="col-sm-6 col-md-4 col-lg-4 col-slg-4">
                        <div class="form-group">
                            <label class="col-sm-3 control-label">创建时间：</label>
                            <div class="col-sm-9">
                                <input name="search_date" type="text" value=""
                                       readonly="readonly" id="search_date" class="form-control"
                                       placeholder="请选择" style="width: 297px">
                            </div>
                        </div>
                    </div>
                </form>
            </div>
            <div class="panel-footer">
                <a href="javascript:;" class="btn btn-primary" onclick="searchform()">查找</a>
                <a href="javascript:;" class="btn btn-default" onclick="clearform()">清空</a>
            </div>
        </div>
        <div class="panel mgl15 mgr15">

            <div class="panel-heading addCharts mgb10" style="background:#ededed;overflow: hidden">
                商品列表
                <div class=" pull-right" style="margin-top: -9px;">
                    <a href="{:url('shop/goodsadd',['card_id'=>$card['card_id']])}" class="btn btn-info">添加商品</a>
                </div>
            </div>
            <div class="panel-body">

                <div id="myTabContent" class="tab-content">
                    <div class="tab-pane fade in active" id="normal">
                        <table class="table table-bordered" data-toolbar="#normal">
                            <thead>
                            <tr>
                                <th>商品名称</th>
                                <th>商品图片</th>
                                <th>所需积分</th>
                                <th>商品类目</th>
                                <th>商品库存</th>
                                <th>商品状态</th>
                                <th>创建时间</th>
                                <th>操作</th>

                            </tr>
                            </thead>
                            <tbody>
                            {volist name="list" id="vo"}
                            <tr>
                                <td>{$vo.goods_name}</td>
                                <td>{if condition="$vo['goods_type'] eq 'red_money'"}<img src='__STATIC_URL__/static/images/257.png'
                                                                                          {else/}<img
                                        src='{$vo.img_url}' {/if}" style="width:40px;height:40px;"/>
                                </td>
                                <td>{$vo.goods_price}</td>
                                <td>{$vo.cate_name}</td>
                                <td>{$vo.stock}</td>
                                <td>
                                    {switch name="vo.statu"}
                                    {case value="0"}
                                    {eq name=":fileoffcards($vo['goods_card_id'])" value="true"}
                                    正常
                                    {else/}
                                    已过期
                                    {/eq}
                                    {/case}
                                    {case value="1"}下架{/case}
                                    {/switch}
                                </td>
                                <td>{$vo['create_time']}</td>
                                <td class="chakan">
                                    <a class="btn-link"
                                       href="{:url('Shop/goodsinfo',array('id'=>$vo['id'],'card_id'=>$card['card_id']))}">查看</a>
                                    <a class="btn-link"
                                       href="{:url('Shop/goodsedit',array('id'=>$vo['id'],'card_id'=>$card['card_id']))}">|修改</a>
                                    <!--<a class="btn-link"-->
                                    <!--href="{:url('Shop/goodsdel',array('id'=>$vo['id'],'card_id'=>$card['card_id']))}">|删除</a>-->
                                    <a class="btn-link"
                                       href="{:url('Shop/goodsoff',array('id'=>$vo['id'],'card_id'=>$card['card_id']))}">
                                        {switch name="vo.statu"}
                                        {case value="0"}|下架{/case}
                                        {case value="1"}|上架{/case}
                                        {/switch}
                                    </a>
                                </td>
                            </tr>
                            {/volist}
                            </tbody>
                        </table>
                    </div>
                    {$list->render()}
                </div>
            </div>
        </div>
        {include file='public/footer'/}
    </div>
</section>
<!-- 模态框（Modal） -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h4 class="modal-title" id="myModalLabel">二维码预览</h4>
            </div>
            <div class="modal-body">
                <img src="" class="img-responsive" id="modalcode" style="margin: 0 auto;">
            </div>
            <div class="modal-footer">
                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                <button type="button" class="btn btn-primary" data-dismiss="modal">确认</button>
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>
</body>
<script type="text/javascript">
    $(function () {

        $(".glyphicon-qrcode").click(function () {
            var src = $(this).attr("data-src");
            if (!!src) {
                $("#modalcode").attr("src", src);
                $("#myModal").modal("show");
            } else {
                alert("未获得二维码")
            }
        });
        $("#myModal").on("hide.bs.modal", function () {
            $("#modalcode").attr("src", "");
        })
    })
</script>
</html>
